//-----------------------------------------------------------------------------
// Name: InanimateObject.cpp
// Auth: Dante Ratto, Rob Darty, Paul Godfrey
// Desc: AnimateObjects class
//-----------------------------------------------------------------------------

#include "SharedConstants.h"
#include "InanimateObject.h"
#include "Assert.h"

#include <windows.h>
#include "corona/corona.h"
#include <GL/glut.h>
#include <math.h>
#include <cstdlib>  // For srand() and rand()
#include "Bounding.h"
#include "DisplayManager.h"
#include "Systems.h"
#include "AnimateObjectManager.h"
#include "InanimateObjectManager.h"



#include <iostream>
using namespace std;

//-----------------------------------------------------------------------------
// Globals:
//-----------------------------------------------------------------------------
cInanimateObject gInanimateObject;

//-----------------------------------------------------------------------------
// Functions:
//-----------------------------------------------------------------------------
cInanimateObject* GetInanimateObject()
{
	return &gInanimateObject;
}

//-----------------------------------------------------------------------------
// class cInanimateObject:
//-----------------------------------------------------------------------------
cInanimateObject::cInanimateObject()
{
	mPosition[0] = 0;
	mPosition[1] = 0;
	mPosition[2] = 0;
	mColor[0] = 0;
	mColor[1] = 0;
	mColor[2] = 0;
	mColor[3] = 0;
	mColor[4] = 0;
	mColor[5] = 0;
	eInanimateType eType = kWall;
	/*mBounding.SetBounding( mPosition[0] - 1.0f, mPosition[0] + 1.0f, mPosition[1]-1.0f,
							mPosition[1] + 1.0f, mPosition[2] - 1.0f, mPosition[2] + 1.0f );*/
}

cInanimateObject::cInanimateObject(float x, float y, float z)
{
	mPosition[0] = x;
	mPosition[1] = y;
	mPosition[2] = z;
	mColor[0] = 0;
	mColor[1] = 0;
	mColor[2] = 0;
	mColor[3] = 0;
	mColor[4] = 0;
	mColor[5] = 0;
	eInanimateType eType = kRightWall;
	//mBounding.SetBounding( mPosition[0] - 1.0f, mPosition[0] + 1.0f, mPosition[1]-1.0f,
						//	mPosition[1] + 1.0f, mPosition[2] - 1.0f, mPosition[2] + 1.0f );
}

cInanimateObject::~cInanimateObject()
{
}

//sets the color of objects based on type
void cInanimateObject::SetType(eInanimateType eType)
{
	mType = eType;

	switch (mType)
	{
	case kWall:
		{
			SetColor(kColorWall);
		break;
		}
	case kLeftWall:
		{
			SetColor(kColorWall);
		break;
		}

	case kRightWall:
		{
			SetColor(kColorWall);
		break;
		}
	
	case kFrontWall:
		{
			SetColor(kColorWall);
		break;
		}

	case kBackWall:
		{
			SetColor(kColorWall);
		break;
		}

	case kBox:
		{
			SetColor(kColorBox);
		break;
		}

	case kBarn:
		{
			SetColor(kColorBarn);
		break;
		}
	}
}
//Draws Inanimate objects based on enum type
void cInanimateObject::Draw(eInanimateType eType)
{
	//DrawWall();
	mType = eType;

	//DrawTree();

	
	switch (mType)
	{
	case kWall:
		{
			DrawWall();
		break;
		}
	case kRightWall:
		{
			//DrawRightWall();
		break;
		}
	
	case kLeftWall:
		{
			//DrawLeftWall();
		break;
		}
	
	case kFrontWall:
		{
			//DrawFrontWall();
		break;
		}

	case kBackWall:
		{
			//DrawBackWall();
		break;
		}

	case kBox:
		{
			//DrawBox();
		break;
		}

		case kBarn:
		{
			DrawBarn();
		break;
		}

		case kTree:
		{
			DrawTree();
			break;
		}

		case kPalmTree:
		{
			DrawPalmTree();
			break;
		}

		case kFence:
		{
			DrawFence();
			break;
		}
		case kTownCenterWall:
		{
			cAnimateObjectManager* pAnimateObjectManager = GetAnimateObjectManager();
			bool zExist = pAnimateObjectManager->GetmZombies();
			//cout << zExist <<endl;
			cInanimateObjectManager* pInanimateObjectManager = GetInanimateObjectManager();
			list<cInanimateObject>* liInanimate = pInanimateObjectManager->GetInanimateList();
			list<cInanimateObject>::iterator itIAO;

			cDisplayManager* pDisplayManager = GetDisplayManager();

			bool bInside = false;

			//this finds if inside of final trigger point
			if ( pDisplayManager->GetCameraX() > -80.0 && pDisplayManager->GetCameraX() < 80.0 &&
					pDisplayManager->GetCameraZ() > -99.0 && pDisplayManager->GetCameraZ() < 180.0 )
			{
				bInside = true;
				pAnimateObjectManager->SetBoss(true);
			}


			//this is the trigger for the final area and if it draws town center wall based on perameters
			if ( ( ( pDisplayManager->GetCameraX() > 10.0 && pDisplayManager->GetCameraX() < 40.0 &&
					pDisplayManager->GetCameraZ() > 180.0 && pDisplayManager->GetCameraZ() < 190.0 ) &&
					zExist == false && bInside == false ) )
			{

			DrawTownCenterWall( zExist, bInside );


			}
			else if ( bInside )
			{
				DrawTownCenterWall( zExist, bInside );
			}
			else
			{
				zExist = true;
				DrawTownCenterWall( zExist, bInside );				
			}

			break;


		}
		case kGate:
		{
			cDisplayManager* pDisplayManager = GetDisplayManager();
			bool bInside = false;

			//this finds if you enter the playing area, once inside, shuts gate behind you
			if ( pDisplayManager->GetCameraX() > -250.0 && pDisplayManager->GetCameraX() < 250.0f &&
					pDisplayManager->GetCameraY() > 0.0 && pDisplayManager-> GetCameraY() < 3.0f &&
					pDisplayManager->GetCameraZ() > -149.0f && pDisplayManager->GetCameraZ()< 250.0f )
			{
				bInside = true;
			}
			else
			{
				bInside = false;
			}
			DrawGate( bInside );
			break;
		}
	}
}

//returns inanimate objects enum type
enum eInanimateType cInanimateObject::GetType()
{
	return mType;
}

//returns x Position of inanimates
float cInanimateObject::GetPositionX()
{
	return mPosition[0];
}

//returns y Position of inanimates
float cInanimateObject::GetPositionY()
{
	return mPosition[1];
}

//returns z Position of inanimates
float cInanimateObject::GetPositionZ()
{
	return mPosition[2];
}

//sets Position with a vector
void cInanimateObject::SetPosition(tVector3f& position)
{
	mPosition[0] = position[0];
	mPosition[1] = position[1];
	mPosition[2] = position[2];
		//mBounding.SetBounding( mPosition[0] - 1.0f, mPosition[0] + 1.0f, mPosition[1]-1.0f,
	//						mPosition[1] + 1.0f, mPosition[2] - 1.0f, mPosition[2] + 1.0f );
}

//non vector set of position
void cInanimateObject::SetPosition(float positionX, float positionY, float positionZ)
{
	mPosition[0] = positionX;
	mPosition[1] = positionY;
	mPosition[2] = positionZ;
	//mBounding.SetBounding( mPosition[0] - 1.0f, mPosition[0] + 1.0f, mPosition[1]-1.0f,
						//	mPosition[1] + 1.0f, mPosition[2] - 1.0f, mPosition[2] + 1.0f );
}

//sets the color of inanimate objects
void cInanimateObject::SetColor(const tVector3f& color)
{
	mColor[0] = color[0];
	mColor[1] = color[1];
	mColor[2] = color[2];
}

//draws left wall
void cInanimateObject::DrawLeftWall()
{
		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		

		glPushMatrix();
		{
			//glTranslatef( 20.0f, 0, 0 );

			//glTranslatef(10.0f, 0, 0);
			glBegin(GL_QUADS);

			glTranslatef( mPosition[0], mPosition[1], mPosition[2] );

			glColor3f(mColor[0], mColor[1], mColor[2]);
			glVertex3f(50.0f, 10.0f, 50.0f);
			glVertex3f(50.0f, 10.0f, -50.0f);
			glVertex3f(50.0f, 0.0f, -50.0f);
			glVertex3f(50.0f, 0.0f, 50.0f);

			glEnd();

		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);
		//glutSwapBuffers();

		mBounding.SetBounding( mPosition[0] + 50.2f, mPosition[0] + 49.8f, mPosition[1], 
							mPosition[1] + 10.0f, mPosition[2] - 51.0f, mPosition[2] + 51.0f);
}

//draws the front wall
void cInanimateObject::DrawFrontWall()
{
		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
			glBegin(GL_QUADS);

			glColor3f(mColor[0], mColor[1], mColor[2]);
			glVertex3f(-50.0f, 10.0f, 50.0f);
			glVertex3f(50.0f, 10.0f, 50.0f);
			glVertex3f(50.0f, 0.0f, 50.0f);
			glVertex3f(-50.0f, 0.0f, 50.0f);
			glEnd();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		mBounding.SetBounding( mPosition[0] - 0.1f, mPosition[0] + 0.1f, mPosition[1]- 0.1f, 
							mPosition[1] + 1.0f, mPosition[2] - 1.0f, mPosition[2] + 1.0f);
}

//draws the right wall
void cInanimateObject::DrawRightWall()
{
		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
			glBegin(GL_QUADS);

			glColor3f(mColor[0], mColor[1], mColor[2]);
			glVertex3f(-50.0f, 10.0f, -50.0f);
			glVertex3f(-50.0f, 10.0f, 50.0f);
			glVertex3f(-50.0f, 0.0f, 50.0f);
			glVertex3f(-50.0f, 0.0f, -50.0f);
			glEnd();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		mBounding.SetBounding( mPosition[0] - 0.1f, mPosition[0] + 0.1f, mPosition[1]- 0.1f, 
							mPosition[1] + 1.0f, mPosition[2] - 1.0f, mPosition[2] + 1.0f);
}

//draws the back wall
void cInanimateObject::DrawBackWall()
{
		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
			glBegin(GL_QUADS);

			glColor3f(mColor[0], mColor[1], mColor[2]);
			glVertex3f(50.0f, 10.0f, -50.0f);
			glVertex3f(-50.0f, 10.0f, -50.0f);
			glVertex3f(-50.0f, 0.0f, -50.0f);
			glVertex3f(50.0f, 0.0f, -50.0f);
			glEnd();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		mBounding.SetBounding( mPosition[0] - 0.1f, mPosition[0] + 0.1f, mPosition[1]- 0.1f, 
							mPosition[1] + 1.0f, mPosition[2] - 1.0f, mPosition[2] + 1.0f);
}

//returns the bounding box of inanimates
cBounding* cInanimateObject::GetBounding()
{
	return &mBounding;
}

void cInanimateObject::SetBounding( float minx, float maxx, float miny, float maxy,
																	 float minz, float maxz )
{
	gInanimateObject.mBounding.SetBounding( minx, maxx, miny, maxy, minz, maxz);

	return;
}

//draws a wall
void cInanimateObject::DrawWall()
{
		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
			glBegin(GL_QUAD_STRIP);

			glColor3f(mColor[0], mColor[1], mColor[2]);
			glNormal3f(0.0f,0.0f,1.0f);
			glVertex3f(-50.0f, 10.0f, 50.0f);
			glVertex3f(-50.0f, 0.0f, 50.0f);		
			glVertex3f(50.0f, 10.0f, 50.0f);
			glVertex3f(50.0f, 0.0f, 50.0f);
	
			glNormal3f(1.0f,0.0f,0.0f);
			glVertex3f(50.0f, 10.0f, -50.0f);
			glVertex3f(50.0f, 0.0f, -50.0f);

			glNormal3f(0.0f,0.0f,-1.0f);
			glVertex3f(-50.0f, 10.0f, -50.0f);
			glVertex3f(-50.0f, 0.0f, -50.0f);

			glNormal3f(-1.0f,0.0f,0.0f);
			glVertex3f(-50.0f, 10.0f, 50.0f);
			glVertex3f(-50.0f, 0.0f, 50.0f);	
			glEnd();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		mBounding.SetBounding( mPosition[0] - 50.5f, mPosition[0] + 50.5f, mPosition[1]- 0.1f, 
							mPosition[1] + 10.0f, mPosition[2] - 50.5f, mPosition[2] + 50.5f);
}


//draws normal tree
void cInanimateObject::DrawTree()
{

	GLUquadricObj *pObj;

	pObj = gluNewQuadric();
	gluQuadricNormals( pObj, GLU_SMOOTH );

	glPushMatrix();

	glTranslatef( mPosition[0], mPosition[ 1 ], mPosition[ 2 ] );
	//base
	glPushMatrix();
		glColor3f( 0.6f, 0.3f, 0.3f );

		glTranslatef( 0.0f, 0.0f, 0.0f );

		glRotatef( -90.0f, 1.0f, 0.0f, 0.0f );

		gluCylinder( pObj, 1.5f, 0.75f, 10.0f, 26, 13 );

	glPopMatrix();

	//top
	glPushMatrix();

	glColor3f( 0, 0.6f, 0 );

	glTranslatef( 0, 10.0f, 0 );
	glutSolidSphere( 5.0f, 5, 5 );
	glPopMatrix();

	glPopMatrix();

	mBounding.SetBounding( mPosition[0] - 1.5f, mPosition[0] + 1.5f, mPosition[1], 
							mPosition[1] + 15.0f, mPosition[2] - 1.5f, mPosition[2] + 1.5f);
	gluDeleteQuadric(pObj);
}



//draws palm trees
void cInanimateObject::DrawPalmTree()
{

	GLUquadricObj *pObj;

	pObj = gluNewQuadric();
	gluQuadricNormals( pObj, GLU_SMOOTH );

	glPushMatrix();
		glTranslatef( mPosition[0], mPosition[1], mPosition[2] );
	//base
	glPushMatrix();
		glColor3f( 1.0f, 0.8f, 0.4f );

		glTranslatef( 0.0f, 0.0f, 0.0f );

		glRotatef( -90.0f, 1.0f, 0.0f, 0.0f );

		gluCylinder( pObj, 0.30f, 0.20f, 10.0f, 26, 13 );

	glPopMatrix();

	//top
	glColor3f( 0, 0.6f, 0 );

	//first frond
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( -1.0f, 10.5f, -0.6f );
	glVertex3f( -1.0f, 10.5f, 0.6f );
	glVertex3f( -3.0f, 8.0f, 0 );

	glEnd();

	
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( -1.0f, 10.5f, 0.6f );
	glVertex3f( -1.0f, 10.5f, -0.6f );
	glVertex3f( -3.0f, 8.0f, 0 );

	glEnd();
	
	//second frond
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( 0.6f, 10.5f, -1.0f );
	glVertex3f( -0.6f, 10.5f, -1.0f );
	glVertex3f( 0, 8.0f, -3.0f );

	glEnd();

	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( -0.6f, 10.5f, -1.0f );
	glVertex3f( 0.6f, 10.5f, -1.0f );
	glVertex3f( 0, 8.0f, -3.0f );

	glEnd();

	//third frond
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( 1.0f, 10.5f, -0.6f );
	glVertex3f( 1.0f, 10.5f, 0.6f );
	glVertex3f( 3.0f, 8.0f, 0 );

	glEnd();

	
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( 1.0f, 10.5f, 0.6f );
	glVertex3f( 1.0f, 10.5f, -0.6f );
	glVertex3f( 3.0f, 8.0f, 0 );

	glEnd();

	//fourth frond
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( 0.6f, 10.5f, 1.0f );
	glVertex3f( -0.6f, 10.5f, 1.0f );
	glVertex3f( 0, 8.0f, 3.0f );

	glEnd();

	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( -0.6f, 10.5f, 1.0f );
	glVertex3f( 0.6f, 10.5f, 1.0f );
	glVertex3f( 0, 8.0f, 3.0f );

	glEnd();

	//fifth frond( top row )
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( -0.6f, 11.5f, -1.2f );
	glVertex3f( -1.2f, 11.5f, -0.6f );
	glVertex3f( -3.0f, 8.0f, -3.0f );

	glEnd();

	
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( -1.2f, 11.5f, -0.6f );
	glVertex3f( -0.6f, 11.5f, -1.2f );
	glVertex3f( -3.0f, 8.0f, -3.0f );

	glEnd();

	//sixth frond
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( -1.2f, 11.5f, 0.6f );
	glVertex3f( -0.6f, 11.5f, 1.2f );
	glVertex3f( -3.0f, 8.0f, 3.0f );

	glEnd();

	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( -0.6f, 11.5f, 1.2f );
	glVertex3f( -1.2f, 11.5f, 0.6f );
	glVertex3f( -3.0f, 8.0f, 3.0f );

	glEnd();

	//seventh frond
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( 0.6f, 11.5f, 1.2f );
	glVertex3f( 1.2f, 11.5f, 0.6f );
	glVertex3f( 3.0f, 8.0f, 3.0f );

	glEnd();

	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( 1.2f, 11.5f, 0.6f );
	glVertex3f( 0.6f, 11.5f, 1.2f );
	glVertex3f( 3.0f, 8.0f, 3.0f );

	glEnd();

	//eighth frond
	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( 1.2f, 11.5f, -0.6f );
	glVertex3f( 0.6f, 11.5f, -1.2f );
	glVertex3f( 3.0f, 8.0f, -3.0f );

	glEnd();

	glBegin( GL_TRIANGLE_STRIP );

	glVertex3f( 0, 10.0f, 0 );
	glVertex3f( 0.6f, 11.5f, -1.2f );
	glVertex3f( 1.2f, 11.5f, -0.6f );
	glVertex3f( 3.0f, 8.0f, -3.0f );

	glEnd();

	glPopMatrix();

	mBounding.SetBounding( mPosition[0] - 0.30f, mPosition[0] + 0.30f, mPosition[1], 
							mPosition[1] + 15.0f, mPosition[2] - 0.30f, mPosition[2] + 0.30f );
	gluDeleteQuadric(pObj);

}

//sets the x offset member data
void cInanimateObject::SetXOffset(float x)
{
	mXOffset=x;
}

//sets the z offset member data
void cInanimateObject::SetZOffset(float z)
{
	mZOffset=z;
}

//draws a fence
void cInanimateObject::DrawFence()
{
	glColor3f(mColor[0], mColor[1], mColor[2]);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glBegin(GL_QUAD_STRIP);

			glVertex3f(mXOffset, 0.0f, mZOffset);
			glVertex3f(mXOffset, 3.0f, mZOffset);
			glVertex3f(-mXOffset, 0.0f, mZOffset);
			glVertex3f(-mXOffset, 3.0f, mZOffset);	

			glVertex3f(-mXOffset, 0.0f, -mZOffset);
			glVertex3f(-mXOffset, 3.0f, -mZOffset);

			glVertex3f(mXOffset, 0.0f, -mZOffset);
			glVertex3f(mXOffset, 3.0f, -mZOffset);

			glVertex3f(mXOffset, 0.0f, mZOffset);
			glVertex3f(mXOffset, 3.0f, mZOffset);

			glEnd();

		}
		glPopMatrix();
}

//All DrawFence1 - DrawFence12 not used now...
void cInanimateObject::DrawFence1()
{
	mPosition[0] = -122.5f;
	mPosition[2] = -205.0f;

		glColor3f(mColor[0], mColor[1], mColor[2]);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
			glPushMatrix();
			glTranslatef( 122.5f, 0.0f, 205.0f );

			glBegin(GL_QUAD_STRIP);

			glVertex3f(-15.0f, 0.0f, -180.0f);
			glVertex3f(-15.0f, 3.0f, -180.0f);
			glVertex3f(-230.0f, 0.0f, -180.0f);
			glVertex3f(-230.0f, 3.0f, -180.0f);	

			glVertex3f(-230.0f, 0.0f, -230.0f);
			glVertex3f(-230.0f, 3.0f, -230.0f);

			glVertex3f(-15.0f, 0.0f, -230.0f);
			glVertex3f(-15.0f, 3.0f, -230.0f);

			glVertex3f(-15.0f, 0.0f, -180.0f);
			glVertex3f(-15.0f, 3.0f, -180.0f);

			glEnd();
			glPopMatrix();
		}
		glPopMatrix();

		mBounding.SetBounding( mPosition[0] - 107.5f, mPosition[0] + (107.5f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 25.0f, mPosition[2] + (25.0f));
}

void cInanimateObject::DrawFence2()
{

	mPosition[0] = -122.5f;
	mPosition[2] = -125.0f;

		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef(122.5f, 0.0f, 125.0f);
			glBegin(GL_QUAD_STRIP);

			glVertex3f(-15.0f, 0.0f, -100.0f);
			glVertex3f(-15.0f, 3.0f, -100.0f);
			glVertex3f(-230.0f, 0.0f, -100.0f);
			glVertex3f(-230.0f, 3.0f, -100.0f);	

			glVertex3f(-230.0f, 0.0f, -150.0f);
			glVertex3f(-230.0f, 3.0f, -150.0f);

			glVertex3f(-15.0f, 0.0f, -150.0f);
			glVertex3f(-15.0f, 3.0f, -150.0f);

			glVertex3f(-15.0f, 0.0f, -100.0f);
			glVertex3f(-15.0f, 3.0f, -100.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		//mBounding.SetBounding( mPosition[0] - 230.0f, mPosition[0] + (-15.0f), mPosition[1], 
		//					mPosition[1] + 3.0f, mPosition[2] - 150.0f, mPosition[2] + (-100.0f));

		mBounding.SetBounding( mPosition[0] - 107.5f, mPosition[0] + (107.5f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 25.0f, mPosition[2] + (25.0f));

}

void cInanimateObject::DrawFence3()
{
	mPosition[0] = -155.0f;
	mPosition[2] = -42.5f;

		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);

		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef(155.0f, 0.0f, 42.5f);
			glBegin(GL_QUAD_STRIP);

			glVertex3f(-80.0f, 0.0f, -15.0f);
			glVertex3f(-80.0f, 3.0f, -15.0f);
			glVertex3f(-230.0f, 0.0f, -15.0f);
			glVertex3f(-230.0f, 3.0f, -15.0f);	

			glVertex3f(-230.0f, 0.0f, -70.0f);
			glVertex3f(-230.0f, 3.0f, -70.0f);

			glVertex3f(-80.0f, 0.0f, -70.0f);
			glVertex3f(-80.0f, 3.0f, -70.0f);

			glVertex3f(-80.0f, 0.0f, -15.0f);
			glVertex3f(-80.0f, 3.0f, -15.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		mBounding.SetBounding( mPosition[0] - 75.0f, mPosition[0] + (75.0f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 27.5f, mPosition[2] + (27.5f));

}

void cInanimateObject::DrawFence4()
{
	mPosition[0] = -155.0f;
	mPosition[2] = 42.5f;

		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef( 155.0f, 0.0f, -42.5f );
			glBegin(GL_QUAD_STRIP);

			glVertex3f(-80.0f, 0.0f, 70.0f);
			glVertex3f(-80.0f, 3.0f, 70.0f);
			glVertex3f(-230.0f, 0.0f, 70.0f);
			glVertex3f(-230.0f, 3.0f, 70.0f);	

			glVertex3f(-230.0f, 0.0f, 15.0f);
			glVertex3f(-230.0f, 3.0f, 15.0f);

			glVertex3f(-80.0f, 0.0f, 15.0f);
			glVertex3f(-80.0f, 3.0f, 15.0f);

			glVertex3f(-80.0f, 0.0f, 70.0f);
			glVertex3f(-80.0f, 3.0f, 70.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		//mBounding.SetBounding( mPosition[0] - 230.0f, mPosition[0] + (-80.0f), mPosition[1], 
		//					mPosition[1] + 3.0f, mPosition[2] - (-15.0f), mPosition[2] + 70.0f);

		mBounding.SetBounding( mPosition[0] - 75.0f, mPosition[0] + (75.0f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 27.5f, mPosition[2] + (27.5f));

}

void cInanimateObject::DrawFence5()
{
	mPosition[0] = -122.5f;
	mPosition[2] = 125.0f;

		glColor3f(mColor[0], mColor[1], mColor[2]);

		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef(122.5f, 0.0f, -125.0f);
			glBegin(GL_QUAD_STRIP);

			glVertex3f(-15.0f, 0.0f, 150.0f);
			glVertex3f(-15.0f, 3.0f, 150.0f);
			glVertex3f(-230.0f, 0.0f, 150.0f);
			glVertex3f(-230.0f, 3.0f, 150.0f);	

			glVertex3f(-230.0f, 0.0f, 100.0f);
			glVertex3f(-230.0f, 3.0f, 100.0f);

			glVertex3f(-15.0f, 0.0f, 100.0f);
			glVertex3f(-15.0f, 3.0f, 100.0f);

			glVertex3f(-15.0f, 0.0f, 150.0f);
			glVertex3f(-15.0f, 3.0f, 150.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		/*mBounding.SetBounding( mPosition[0] - 230.0f, mPosition[0] + (-15.0f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - (-100.0f), mPosition[2] + 150.0f );*/

		mBounding.SetBounding( mPosition[0] - 107.5f, mPosition[0] + (107.5f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 25.0f, mPosition[2] + (25.0f));

}

void cInanimateObject::DrawFence6()
{
		mPosition[ 0 ] = -122.5f;
		mPosition[ 2 ] = 205.0f;

		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef( 122.5f, 0.0f, -205.0f );
			glBegin(GL_QUAD_STRIP);

			glVertex3f(-15.0f, 0.0f, 230.0f);
			glVertex3f(-15.0f, 3.0f, 230.0f);
			glVertex3f(-230.0f, 0.0f, 230.0f);
			glVertex3f(-230.0f, 3.0f, 230.0f);	

			glVertex3f(-230.0f, 0.0f, 180.0f);
			glVertex3f(-230.0f, 3.0f, 180.0f);

			glVertex3f(-15.0f, 0.0f, 180.0f);
			glVertex3f(-15.0f, 3.0f, 180.0f);

			glVertex3f(-15.0f, 0.0f, 230.0f);
			glVertex3f(-15.0f, 3.0f, 230.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		//mBounding.SetBounding( mPosition[0] - 230.0f, mPosition[0] + (-15.0f), mPosition[1], 
		//					mPosition[1] + 3.0f, mPosition[2] - (-180.0f), mPosition[2] + 230.0f);

		mBounding.SetBounding( mPosition[0] - 107.5f, mPosition[0] + (107.5f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 25.0f, mPosition[2] + (25.0f));

}

void cInanimateObject::DrawFence7()//based on 6
{
		mPosition[0] = 122.5f;
		mPosition[2] = 205.0f;

		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{


			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef(-122.5f, 0.0f, -205.0f);
			glBegin(GL_QUAD_STRIP);

			glVertex3f(230.0f, 0.0f, 230.0f);
			glVertex3f(230.0f, 3.0f, 230.0f);
			glVertex3f(15.0f, 0.0f, 230.0f);
			glVertex3f(15.0f, 3.0f, 230.0f);	

			glVertex3f(15.0f, 0.0f, 180.0f);
			glVertex3f(15.0f, 3.0f, 180.0f);

			glVertex3f(230.0f, 0.0f, 180.0f);
			glVertex3f(230.0f, 3.0f, 180.0f);

			glVertex3f(230.0f, 0.0f, 230.0f);
			glVertex3f(230.0f, 3.0f, 230.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		//mBounding.SetBounding( mPosition[0] - (-15.0f), mPosition[0] + 230.0f, mPosition[1], 
		//					mPosition[1] + 3.0f, mPosition[2] - (-180.0f), mPosition[2] + 230.0f);

		mBounding.SetBounding( mPosition[0] - 107.5f, mPosition[0] + (107.5f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 25.0f, mPosition[2] + (25.0f));

}

void cInanimateObject::DrawFence8()
{

	mPosition[0] = 122.5f;
	mPosition[2] = 125.0f;

		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef( -122.5f, 0.0f, -125.0f );
			glBegin(GL_QUAD_STRIP);

			glVertex3f(230.0f, 0.0f, 150.0f);
			glVertex3f(230.0f, 3.0f, 150.0f);
			glVertex3f(15.0f, 0.0f, 150.0f);
			glVertex3f(15.0f, 3.0f, 150.0f);	

			glVertex3f(15.0f, 0.0f, 100.0f);
			glVertex3f(15.0f, 3.0f, 100.0f);

			glVertex3f(230.0f, 0.0f, 100.0f);
			glVertex3f(230.0f, 3.0f, 100.0f);

			glVertex3f(230.0f, 0.0f, 150.0f);
			glVertex3f(230.0f, 3.0f, 150.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		//mBounding.SetBounding( mPosition[0] - (-15.0f), mPosition[0] + 230.0f, mPosition[1], 
		//					mPosition[1] + 3.0f, mPosition[2] - (-100.0f), mPosition[2] + 150.0f );

		mBounding.SetBounding( mPosition[0] - 107.5f, mPosition[0] + (107.5f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 25.0f, mPosition[2] + (25.0f));

}

void cInanimateObject::DrawFence9()
{
		mPosition[0] = 155.0f;
		mPosition[2] = 42.5f;

		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{


			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef(-155.0f, 0.0f, -42.5f);
			glBegin(GL_QUAD_STRIP);

			glVertex3f(230.0f, 0.0f, 70.0f);
			glVertex3f(230.0f, 3.0f, 70.0f);
			glVertex3f(80.0f, 0.0f, 70.0f);
			glVertex3f(80.0f, 3.0f, 70.0f);	

			glVertex3f(80.0f, 0.0f, 15.0f);
			glVertex3f(80.0f, 3.0f, 15.0f);

			glVertex3f(230.0f, 0.0f, 15.0f);
			glVertex3f(230.0f, 3.0f, 15.0f);

			glVertex3f(230.0f, 0.0f, 70.0f);
			glVertex3f(230.0f, 3.0f, 70.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		//mBounding.SetBounding( mPosition[0] - (-80.0f), mPosition[0] + 230.0f, mPosition[1], 
		//					mPosition[1] + 3.0f, mPosition[2] - (-15.0f), mPosition[2] + 70.0f);

		mBounding.SetBounding( mPosition[0] - 75.0f, mPosition[0] + (75.0f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 27.5f, mPosition[2] + (27.5f));

}

void cInanimateObject::DrawFence10()
{
		mPosition[0] = 155.0f;
		mPosition[2] = -42.5f;
		
		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{


			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef(-155.0f, 0.0f, 42.5f);
			glBegin(GL_QUAD_STRIP);

			glVertex3f(230.0f, 0.0f, -15.0f);
			glVertex3f(230.0f, 3.0f, -15.0f);
			glVertex3f(80.0f, 0.0f, -15.0f);
			glVertex3f(80.0f, 3.0f, -15.0f);	

			glVertex3f(80.0f, 0.0f, -70.0f);
			glVertex3f(80.0f, 3.0f, -70.0f);

			glVertex3f(230.0f, 0.0f, -70.0f);
			glVertex3f(230.0f, 3.0f, -70.0f);

			glVertex3f(230.0f, 0.0f, -15.0f);
			glVertex3f(230.0f, 3.0f, -15.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		//mBounding.SetBounding( mPosition[0] - (-80.0f), mPosition[0] + 230.0f, mPosition[1], 
		//					mPosition[1] + 3.0f, mPosition[2] - 70.0f, mPosition[2] + (-15.0f));

		mBounding.SetBounding( mPosition[0] - 75.0f, mPosition[0] + (75.0f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 27.5f, mPosition[2] + (27.5f));

}

void cInanimateObject::DrawFence11()
{
	mPosition[0] = 122.5f;
	mPosition[2] = -125.0f;

		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef(-122.5f, 0.0f, 125.0f);
			glBegin(GL_QUAD_STRIP);

			glVertex3f(230.0f, 0.0f, -100.0f);
			glVertex3f(230.0f, 3.0f, -100.0f);
			glVertex3f(15.0f, 0.0f, -100.0f);
			glVertex3f(15.0f, 3.0f, -100.0f);	

			glVertex3f(15.0f, 0.0f, -150.0f);
			glVertex3f(15.0f, 3.0f, -150.0f);

			glVertex3f(230.0f, 0.0f, -150.0f);
			glVertex3f(230.0f, 3.0f, -150.0f);

			glVertex3f(230.0f, 0.0f, -100.0f);
			glVertex3f(230.0f, 3.0f, -100.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		//mBounding.SetBounding( mPosition[0] - (-15.0f), mPosition[0] + 230.0f, mPosition[1], 
		//					mPosition[1] + 3.0f, mPosition[2] - 150.0f, mPosition[2] + (-100.0f));

		mBounding.SetBounding( mPosition[0] - 107.5f, mPosition[0] + (107.5f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 25.0f, mPosition[2] + (25.0f));

}

void cInanimateObject::DrawFence12()
{
	mPosition[0] = 122.5f;
	mPosition[2] = -205.0f;

		glColor3f(mColor[0], mColor[1], mColor[2]);
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

			glPushMatrix();
			glTranslatef(-122.5f, 0.0f, 205.0f );
			glBegin(GL_QUAD_STRIP);

			glVertex3f(230.0f, 0.0f, -180.0f);
			glVertex3f(230.0f, 3.0f, -180.0f);
			glVertex3f(15.0f, 0.0f, -180.0f);
			glVertex3f(15.0f, 3.0f, -180.0f);	

			glVertex3f(15.0f, 0.0f, -230.0f);
			glVertex3f(15.0f, 3.0f, -230.0f);

			glVertex3f(230.0f, 0.0f, -230.0f);
			glVertex3f(230.0f, 3.0f, -230.0f);

			glVertex3f(230.0f, 0.0f, -180.0f);
			glVertex3f(230.0f, 3.0f, -180.0f);


			glEnd();
			glPopMatrix();
		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		//mBounding.SetBounding( mPosition[0] - (-15.0f), mPosition[0] + 230.0f, mPosition[1], 
		//					mPosition[1] + 3.0f, mPosition[2] - 230.0f, mPosition[2] + (-180.0f));

		mBounding.SetBounding( mPosition[0] - 107.5f, mPosition[0] + (107.5f), mPosition[1], 
							mPosition[1] + 3.0f, mPosition[2] - 25.0f, mPosition[2] + (25.0f));

}

//draws the town center final area wall
void cInanimateObject::DrawTownCenterWall( bool bTest, bool bInside )
{
	//if there are zombies and you are not in the trigger zone
	if ( bTest == true && bInside == false )
	{
		glColor3f(0.5, 0.5, 0.5 );
		//glDisable(GL_CULL_FACE);
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
			glBegin(GL_QUAD_STRIP);

			glVertex3f(80.0f, 0.0f, 100.0f);
			glVertex3f(80.0f, 10.0f, 100.0f);
			glVertex3f(-80.0f, 0.0f, 100.0f);
			glVertex3f(-80.0f, 10.0f, 100.0f);	

			glVertex3f(-80.0f, 0.0f, -100.0f);
			glVertex3f(-80.0f, 10.0f, -100.0f);

			glVertex3f(80.0f, 0.0f, -100.0f);
			glVertex3f(80.0f, 10.0f, -100.0f);

			glVertex3f(80.0f, 0.0f, 100.0f);
			glVertex3f(80.0f, 10.0f, 100.0f);


			glEnd();

			//glBegin( GL_QUADS );
			//	glColor3f( 0.0f, 0.0f, 1.0f );
			//	glVertex3f( 80.1f, 10.0f, 15.0f );
			//	glVertex3f( 80.1f, 0.0f, 15.0f );
			//	glVertex3f( 80.1f, 0.0f, -15.0f );
			//	glVertex3f( 80.1f, 10.0f, -15.0f );
			//glEnd();

			//glBegin( GL_LINES );
			//	glColor3f( 0.0f, 0.0f, 0.0f );
			//	glVertex3f( 80.15f, 0.0f, 0.0f );
			//	glVertex3f( 80.15f, 10.0f, 0.0f );
			//glEnd();

			//glBegin( GL_QUADS );
			//	glColor3f( 0.0f, 1.0f, 0.0f );
			//	glVertex3f( -80.1f, 10.0f, -15.0f );
			//	glVertex3f( -80.1f, 0.0f, -15.0f );
			//	glVertex3f( -80.1f, 0.0f, 15.0f );
			//	glVertex3f( -80.1f, 10.0f, 15.0f );
			//glEnd();

			//glBegin( GL_LINES );
			//	glColor3f( 0.0f, 0.0f, 0.0f );
			//	glVertex3f( -80.15f, 0.0f, 0.0f );
			//	glVertex3f( -80.15f, 10.0f, 0.0f );
			//glEnd();

			glBegin( GL_QUADS );
				glColor3f( 1.0f, 1.0f, 1.0f );
				glVertex3f( 10.0f, 4.0f, 180.0f );
				glVertex3f( 10.0f, 0.0f, 180.0f );
				glVertex3f( 40.0f, 0.0f, 180.0f );
				glVertex3f( 40.0f, 4.0f, 180.0f );
			glEnd();

			glBegin( GL_LINES );
				glColor3f( 0.0f, 0.0f, 0.0f );
				glVertex3f( 25.0f, 0.0f, 180.01f );
				glVertex3f( 25.0f, 4.0f, 180.01f );
			glEnd();

			//glBegin( GL_QUADS );
			//	glColor3f( 1.0f, 1.0f, 1.0f );
			//	glVertex3f( 15.0f, 10.0f, -100.1f );
			//	glVertex3f( 15.0f, 0.0f, -100.1f );
			//	glVertex3f( -15.0f, 0.0f, -100.1f );
			//	glVertex3f( -15.0f, 10.0f, -100.1f );
			//glEnd();

			//glBegin( GL_LINES );
			//	glColor3f( 0.0f, 0.0f, 0.0f );
			//	glVertex3f( 0.0f, 0.0f, -100.15f );
			//	glVertex3f( 0.0f, 10.0f, -100.15f );
			//glEnd();

		

		}
		glPopMatrix();
		//glEnable(GL_CULL_FACE);

		mBounding.SetBounding( mPosition[0] +10, mPosition[0] + 40.0f, mPosition[1], 
							mPosition[1] + 15.0f, mPosition[2] +120.0f, mPosition[2] + (180.0f) );
	}
	//if you are inside and zombies are not around
	else if ( bInside == true )//( bTest == false && bInside == true )
	{
		glDisable(GL_CULL_FACE);

		glColor3f(0.5, 0.5, 0.5 );
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
			glBegin(GL_QUAD_STRIP);

			//glVertex3f(80.0f, 0.0f, 100.0f);
			//glVertex3f(80.0f, 10.0f, 100.0f);
			glVertex3f( -20.0f, 0.0f, 99.0f );
			glVertex3f( -20.0f, 10.0f, 99.0f );
			glVertex3f(-79.9f, 0.0f, 99.0f);
			glVertex3f(-79.9f, 10.0f, 99.0f);	

			glVertex3f(-79.9f, 0.0f, -99.0f);
			glVertex3f(-79.9f, 10.0f, -99.0f);

			glVertex3f(79.9f, 0.0f, -99.0f);
			glVertex3f(79.9f, 10.0f, -99.0f);

			glVertex3f(79.9f, 0.0f, 99.0f);
			glVertex3f(79.9f, 10.0f, 99.0f);

			glVertex3f( 10.0f, 0.0f, 99.0f );
			glVertex3f( 10.0f, 10.0f, 99.0f );


			glEnd();

			//gates
			glBegin( GL_QUADS );
				glColor3f( 1.0f, 1.0f, 1.0f );
				glVertex3f( 10.0f, 4.0f, 180.0f );
				glVertex3f( 10.0f, 0.0f, 180.0f );
				glVertex3f( 40.0f, 0.0f, 180.0f );
				glVertex3f( 40.0f, 4.0f, 180.0f );
			glEnd();

			glBegin( GL_LINES );
				glColor3f( 0.0f, 0.0f, 0.0f );
				glVertex3f( 25.0f, 0.0f, 179.99f );
				glVertex3f( 25.0f, 4.0f, 179.99f );
			glEnd();


		}
		glPopMatrix();
		
		glEnable(GL_CULL_FACE);
		//( pDisplayManager->GetCameraX() > 10.0 && pDisplayManager->GetCameraX() < 40.0 &&
		//			pDisplayManager->GetCameraZ() > 180.0 && pDisplayManager->GetCameraZ() < 190.0 )
		mBounding.SetBounding( -9.0f, 141.0f, 0.0f, 10.0f, 178.0f, 210.0f );
	}
	//if you are in the final stage area
	else
	{
		glDisable(GL_CULL_FACE);

		glColor3f(0.5, 0.5, 0.5 );
		
		glPushMatrix();
		{
			glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
			glBegin(GL_QUAD_STRIP);

			//glVertex3f(80.0f, 0.0f, 100.0f);
			//glVertex3f(80.0f, 10.0f, 100.0f);
			glVertex3f( -20.0f, 0.0f, 100.0f );
			glVertex3f( -20.0f, 10.0f, 100.0f );
			glVertex3f(-80.0f, 0.0f, 100.0f);
			glVertex3f(-80.0f, 10.0f, 100.0f);	

			glVertex3f(-80.0f, 0.0f, -100.0f);
			glVertex3f(-80.0f, 10.0f, -100.0f);

			glVertex3f(80.0f, 0.0f, -100.0f);
			glVertex3f(80.0f, 10.0f, -100.0f);

			glVertex3f(80.0f, 0.0f, 100.0f);
			glVertex3f(80.0f, 10.0f, 100.0f);

			glVertex3f( 10.0f, 0.0f, 100.0f );
			glVertex3f( 10.0f, 10.0f, 100.0f );


			glEnd();

			//gates
			glBegin( GL_QUADS );
				glColor3f( 1.0f, 1.0f, 1.0f );
				glVertex3f( 10.0f, 10.0f, 205.0f );
				glVertex3f( 10.0f, 0.0f, 205.0f );
				glVertex3f( 10.0f, 0.0f, 180.0f );
				glVertex3f( 10.0f, 10.0f, 180.0f );
			glEnd();

			glBegin( GL_QUADS );
				glVertex3f( 40.0f, 10.0f, 205.0f );
				glVertex3f( 40.0f, 0.0f, 205.0f );
				glVertex3f( 40.0f, 0.0f, 180.0f );
				glVertex3f( 40.0f, 10.0f, 180.0f );
			glEnd();

			//glBegin( GL_QUADS );
			//	glColor3f( 1.0f, 1.0f, 1.0f );

			//	glVertex3f( -20.0f, 10.0f, 100.1f );
			//	glVertex3f( -20.0f, 0.0f, 100.1f );
			//	glVertex3f( 10.0f, 0.0f, 100.1f );
			//	glVertex3f( 10.0f, 10.0f, 100.1f );
			//glEnd();

			//glBegin( GL_LINES );
			//	glColor3f( 0.0f, 0.0f, 0.0f );
			//	glVertex3f( -5.0f, 0.0f, 100.15f );
			//	glVertex3f( -5.0f, 10.0f, 100.15f );
			//glEnd();


		}
		glPopMatrix();
		
		glEnable(GL_CULL_FACE);
		mBounding.SetBounding( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 );
	}


}

//draws a gate that shuts behind you after you enter playing area
void cInanimateObject::DrawGate( bool bInside )
{
	//if you are in the playing area
	if ( bInside == true )
	{
		glDisable(GL_CULL_FACE);
		//gates
		glBegin( GL_QUADS );
			glColor3f( 1.0f, 1.0f, 1.0f );
			glVertex3f( -15.0f, 3.0f, -150.0f );
			glVertex3f( -15.0f, 0.0f, -150.0f );
			glVertex3f( 0.0f, 0.0f, -150.0f );
			glVertex3f( 0.0f, 3.0f, -150.0f );
			glEnd();

			glBegin( GL_QUADS );
			glVertex3f( 0.0f, 3.0f, -150.0f );
			glVertex3f( 0.0f, 0.0f, -150.0f );
			glVertex3f( 15.0f, 0.0f, -150.0f );
			glVertex3f( 15.0f, 3.0f, -150.0f );
		glEnd();

		glBegin( GL_LINES );
		glColor3f( 0.0f, 0.0f, 0.0f );
			glVertex3f( 0.0f, 0.0f, -149.9f );
			glVertex3f( 0.0f, 3.0f, -149.9f );
		glEnd();

		mBounding.SetBounding( -15.5, 15.5, 0.0, 3.0, -180.0f, -148.0f );


		glEnable(GL_CULL_FACE);
	}
	//if you are not in the playing area do nothing for now
	else
	{
		//glDisable(GL_CULL_FACE);
		////gates
		//glBegin( GL_QUADS );
		//	glColor3f( 1.0f, 1.0f, 1.0f );
		//	glVertex3f( -15.0f, 3.0f, -135.0f );
		//	glVertex3f( -15.0f, 0.0f, -135.0f );
		//	glVertex3f( -15.0f, 0.0f, -150.0f );
		//	glVertex3f( -15.0f, 3.0f, -150.0f );
		//	glEnd();

		//	glBegin( GL_QUADS );
		//	glVertex3f( 15.0f, 3.0f, -135.0f );
		//	glVertex3f( 15.0f, 0.0f, -135.0f );
		//	glVertex3f( 15.0f, 0.0f, -150.0f );
		//	glVertex3f( 15.0f, 3.0f, -150.0f );
		//glEnd();

		////glBegin( GL_LINES );
		////glColor3f( 0.0f, 0.0f, 0.0f );
		////	glVertex3f( 0.0f, 0.0f, -149.9f );
		////	glVertex3f( 0.0f, 3.0f, -149.9f );
		////glEnd();


		//glEnable(GL_CULL_FACE);

		//mBounding.SetBounding( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 );

	}
}

//draws barn house things
void cInanimateObject::DrawBarn()
{
	glPushMatrix();
		glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

	glPushMatrix();
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glDisable(GL_CULL_FACE);
	glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
	//glTranslatef(mPosition[0], mPosition[1], mPosition[2]);

	glBegin(GL_QUADS);

	//floor
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(3.5f, 0.0f, 3.0f);
	glVertex3f(3.5f, 0.0f, -3.0f);
	glVertex3f(-3.5f, 0.0f, -3.0f);
	glVertex3f(-3.5f, 0.0f, 3.0f);

	//right
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(3.5f, 5.0f, 3.0f);
	glVertex3f(3.5f, 5.0f, -3.0f);
	glVertex3f(3.5f, 0.0f, -3.0f);
	glVertex3f(3.5f, 0.0f, 3.0f);

	//left
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(-3.5f, 5.0f, -3.0f);
	glVertex3f(-3.5f, 5.0f, 3.0f);
	glVertex3f(-3.5f, 0.0f, 3.0f);
	glVertex3f(-3.5f, 0.0f, -3.0f);

	//front top
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(3.5f, 5.0f, 3.0f);
	glVertex3f(3.5f, 5.0f, -3.0f);
	glVertex3f(3.5f, 0.0f, -3.0f);
	glVertex3f(3.5f, 0.0f, 3.0f);

	//front left
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(-2.5f, 5.0f, 3.0f);
	glVertex3f(-3.5f, 5.0f, 3.0f);
	glVertex3f(-3.5f, 0.0f, 3.0f);
	glVertex3f(-2.5f, 0.0f, 3.0f);

	//front right
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(3.5f, 5.0f, 3.0f);
	glVertex3f(2.5f, 5.0f, 3.0f);
	glVertex3f(2.5f, 0.0f, 3.0f);
	glVertex3f(3.5f, 0.0f, 3.0f);

	//right door
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(5.0f, 0.0f, 5.0f);
	glVertex3f(5.0f, 4.0f, 5.0f);
	glVertex3f(2.5f, 4.0f, 3.0f);
	glVertex3f(2.5f, 0.0f, 3.0f);

	//left door
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(-2.5f, 0.0f, 3.0f);
	glVertex3f(-2.5f, 4.0f, 3.0f);
	glVertex3f(-5.0f, 4.0f, 5.0f);
	glVertex3f(-5.0f, 0.0f, 5.0f);

	//back
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(3.5f, 5.0f, -3.0f);
	glVertex3f(-3.5f, 5.0f, -3.0f);
	glVertex3f(-3.5f, 0.0f, -3.0f);
	glVertex3f(3.5f, 0.0f, -3.0f);

	//front roof
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(3.5f, 5.0f, 3.0f);
	glVertex3f(-3.5f, 5.0f, 3.0f);
	glVertex3f(-3.5f, 4.0f, 3.0f);
	glVertex3f(3.5f, 4.0f, 3.0f);

	//roof front right
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(2.0f, 5.0f, 3.0f);
	glVertex3f(2.0f, 8.0f, 3.0f);
	glVertex3f(1.5f, 8.0f, 3.0f);
	glVertex3f(1.5f, 5.0f, 3.0f);

	//roof front left
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(-1.5f, 5.0f, 3.0f);
	glVertex3f(-1.5f, 8.0f, 3.0f);
	glVertex3f(-2.0f, 8.0f, 3.0f);
	glVertex3f(-2.0f, 5.0f, 3.0f);

	//roof back
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(2.0f, 8.0f, -3.0f);
	glVertex3f(2.0f, 5.0f, -3.0f);
	glVertex3f(-2.0f, 5.0f, -3.0f);
	glVertex3f(-2.0f, 8.0f, -3.0f);

	//roof door
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(-1.5f, 5.5f, 3.0f);
	glVertex3f(-1.5f, 7.5f, 3.0f);
	glVertex3f(-4.0f, 7.5f, 5.0f);
	glVertex3f(-4.0f, 5.5f, 5.0f);

	//roof front top
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(1.5f, 7.5f, 3.0f);
	glVertex3f(1.5f, 8.0f, 3.0f);
	glVertex3f(-1.5f, 8.0f, 3.0f);
	glVertex3f(-1.5f, 7.5f, 3.0f);

	//roof front bottom
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(1.5f, 5.0f, 3.0f);
	glVertex3f(1.5f, 5.5f, 3.0f);
	glVertex3f(-1.5f, 5.5f, 3.0f);
	glVertex3f(-1.5f, 5.0f, 3.0f);

	//roof bottom outside right side
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(3.5f, 5.0f, -3.0f);
	glVertex3f(3.5f, 5.0f, 3.0f);
	glVertex3f(4.0f, 5.0f, 3.0f);
	glVertex3f(4.0f, 5.0f, -3.0f);

	//roof bottom outside left side
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(-3.5f, 5.0f, -3.0f);
	glVertex3f(-3.5f, 5.0f, 3.0f);
	glVertex3f(-4.0f, 5.0f, 3.0f);
	glVertex3f(-4.0f, 5.0f, -3.0f);

	//roof outside right side
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(4.0f, 5.0f, 3.0f);
	glVertex3f(4.0f, 5.0f, -3.0f);
	glVertex3f(2.0f, 8.0f, -3.0f);
	glVertex3f(2.0f, 8.0f, 3.0f);

	//roof outside left side
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(-2.0f, 8.0f, 3.0f);
	glVertex3f(-2.0f, 8.0f, -3.0f);
	glVertex3f(-4.0f, 5.0f, -3.0f);
	glVertex3f(-4.0f, 5.0f, 3.0f);

	//roof inside left side
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(0.0f, 9.0f, 3.0f);
	glVertex3f(0.0f, 9.0f, -3.0f);
	glVertex3f(-2.0f, 8.0f, -3.0f);
	glVertex3f(-2.0f, 8.0f, 3.0f);

	//roof outside right side
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(4.0f, 5.0f, 3.0f);
	glVertex3f(4.0f, 5.0f, -3.0f);
	glVertex3f(2.0f, 8.0f, -3.0f);
	glVertex3f(2.0f, 8.0f, 3.0f);

	//roof inside right side
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(2.0f, 8.0f, 3.0f);
	glVertex3f(2.0f, 8.0f, -3.0f);
	glVertex3f(0.0f, 9.0f, -3.0f);
	glVertex3f(0.0f, 9.0f, 3.0f);

	glEnd();

	glBegin(GL_TRIANGLES);

	//roof front right
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(4.0f, 5.0f, 3.0f);
	glVertex3f(2.0f, 8.0f, 3.0f);
	glVertex3f(2.0f, 5.0f, 3.0f);

	//roof front left
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(-2.0f, 5.0f, 3.0f);
	glVertex3f(-2.0f, 8.0f, 3.0f);
	glVertex3f(-4.0f, 5.0f, 3.0f);

	//roof top front
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(2.0f, 8.0f, 3.0f);
	glVertex3f(0.0f, 9.0f, 3.0f);
	glVertex3f(-2.0f, 8.0f, 3.0f);

	//roof top back
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(-2.0f, 8.0f, -3.0f);
	glVertex3f(0.0f, 9.0f, -3.0f);
	glVertex3f(2.0f, 8.0f, -3.0f);

	//roof back left
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(2.0f, 5.0f, -3.0f);
	glVertex3f(2.0f, 8.0f, -3.0f);
	glVertex3f(4.0f, 5.0f, -3.0f);

	//roof back right
	glColor3f(mColor[0], mColor[1], mColor[2]);
	glVertex3f(-4.0f, 5.0f, -3.0f);
	glVertex3f(-2.0f, 8.0f, -3.0f);
	glVertex3f(-2.0f, 5.0f, -3.0f);

	glEnd();
	glEnable(GL_CULL_FACE);
	glPopMatrix();

	glPopMatrix();

	mBounding.SetBounding( mPosition[0] - 3.5f, mPosition[0] + 3.5f, mPosition[1], 
							mPosition[1] + 8.0f, mPosition[2] - 3.0f, mPosition[2] + 3.0f);

}
